function [Alpha,Beta,Gamma] = fn_ABGFromR_Motion( K )

%% Get abg from R
% Input: 
%%            R: rotation matrix, assumed in coordinate rotation form!!!!!!
% Output:
%%        Alpha, Beta, Gamma : correspond to Roll, Pitch, Yaw respectively!!!! 


 Beta = atan2( -( K(3,1) ), sqrt( K(1,1)^2 + K(2,1)^2 ) );
 
 if ( abs( cos( Beta ) ) <= eps )%cos(Beta)==0)
 
     Alpha =  atan2( K(2,1), K(2,2) );
     Beta =  pi/2;
     Gamma = 0;
	 
 else
 
     Alpha =  atan2( K(3,2) / cos(Beta), K(3,3) / cos(Beta) );
     Gamma =  atan2( K(2,1) / cos(Beta), K(1,1) / cos(Beta) );
 end


end
